<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sugar</title>
</head>

<body>
  <script>

    const obj = {
      aa: 11,
      bb: 22
    }

    // 通过点语法获取 aa 属性的值
    console.log(obj.aa);
    // 通过中括号获取 aa 属性的值
    console.log(obj['aa']);

    const type = 'password'
    const obj2 = {
      [type]: 111,
      "bbb": 222
    }

    console.log(obj2);

  </script>
</body>

</html>